<template>
  <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      modal
      :close-on-click-modal="false"
      width="50%"
      @close="handleCloseClick">
    <slot name="content">
    </slot>
    <span slot="footer" class="dialog-footer">
      <el-button size="small" @click="handleCancelClick">取 消</el-button>
      <el-button size="small" type="primary" @click="handleOkClick">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
export default {
  name: "MenuFormDlg",
  props: {
    title: {
      type: String,
      required: true
    },
    show: {
      type: Boolean,
      required: true,
    }
  },
  data() {
    return {
      dialogVisible: this.show,
      topMenus: [],
    }
  },
  methods: {
    handleCancelClick() {
      this.dialogVisible = false;
    },
    handleOkClick() {
      this.$emit('ok-click');
    },
    handleCloseClick() {
      this.$emit('dlg-close');
    }
  },

  watch: {
    show(newVal) {
      this.dialogVisible = newVal;
    }
  },

  created() {
    const topMenusJson = window.sessionStorage.getItem("topMenus");
    this.topMenus = JSON.parse(topMenusJson);
    //const menuData = window.sessionStorage.getItem("menuData");
  }
}
</script>

<style scoped>

</style>